package com.hotel.controller.hotel;

import com.hotel.pojo.Room;
import com.hotel.pojo.RoomType;
import com.hotel.service.RoomService;
import com.hotel.service.RoomTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author shkstart
 * @create 2021-06-30 11:04
 */
@Controller
public class IndexController {

    @Autowired
    RoomTypeService roomTypeService;

    //前往首页
    @RequestMapping("/listRoom")
    public String toFirst(Model model){
        List<RoomType> list = roomTypeService.list(null);
        String s = list.toString();
        System.out.println(s);
        model.addAttribute("AllRoom",list);
        return "indexList";
    }

    //前往登录界面
    @RequestMapping("/toHotelLogin")
    public String toLogin(){
        return "login";
    }

    //前往手机号登录
    @RequestMapping("/toPhoneLogin")
    public String toPhoe(){
        return "login_phone";
    }
    //前往注册界面
    @RequestMapping("/toHotelRegister")
    public String toRegister(){
        return "register";
    }

    //前往客户预订界面
    @RequestMapping("/toHotelBook")
    public String toBook(){
        return "hotel/reserve";
    }

    //前往个人信息界面
    @RequestMapping("/toHotelOrder")
    public String toService(){
        return "hotel/order_form";
    }

//    @RequestMapping("/listRooms")
//    public String toTest(
//            @RequestParam(required = false,defaultValue = "1")Integer pageNum,
//            @RequestParam(defaultValue = "2")Integer pageSize,
//            Model model){
//        List<RoomType> allUserByPageF = roomTypeService.findAllUserByPageF(pageNum, pageSize);
//        model.addAttribute("RoomList",allUserByPageF);
//        System.out.println("POK");
//        return "indexList";
//    }
}
